﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QuestionInputModels>" %>

<%@ Import Namespace="ChoViet.Lib.Helpers" %>
<%@ Import Namespace="ChoViet.Lib.Paging" %>
<%@ Import Namespace="ChoViet.Admin.ViewModels" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Thêm câu hỏi
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%if (ViewData["MessageInfo"] == null)
      { %>
    <% using (Html.BeginForm("Create", "Question", FormMethod.Post, new
       {
           id = "adminForm",
           enctype = "multipart/form-data"
       }))
       {%>
    <%= Html.ValidationSummary(true)%>
    <table class="admintable" width="100%">
        <tbody>
            <tr>
                <td class="key">
                    Phân mục (<font color="red">*</font>)
                </td>
                <td>
                    <%=Html.TreeViewList("CatID", Model.Categories, "-- Chuyên mục --", new { @class = "title" })%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Tiêu đề (<font color="red">*</font>)
                </td>
                <td>
                    <%=Html.TextBox("Title", string.Empty, new { style = "width: 500px;", @class = "required" })%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Nội dung
                </td>
                <td>
                    <%=Html.TextArea("QuestionContent", string.Empty, new { cols = 90, rows = 20 })%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Metadescription
                </td>
                <td>
                    <%=Html.TextArea("MetaDescription", string.Empty, new { cols = 90, rows = 2 })%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Metakeyword
                </td>
                <td>
                    <%=Html.TextArea("MetaKeyword", string.Empty, new { cols = 90, rows = 2 })%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Metatag
                </td>
                <td>
                    <%=Html.TextArea("MetaTag", string.Empty, new { cols = 90, rows = 2 })%>
                </td>
            </tr>
            <tr>
                <td class="key">
                    Trạng thái hiển thị
                </td>
                <td>
                    <%= Html.RadioButton("PubYN", true, new { @checked = "checked" })%>
                    Đăng tin
                    <%= Html.RadioButton("PubYN", false)%>
                    Không đăng
                </td>
            </tr>
             <tr>
                <td class="key">
                    Trạng thái kiểm tra
                </td>
                <td>
                    <%= Html.RadioButton("CheckYN", true, new { @checked = "checked" })%>
                    Đã kiểm tra
                    <%= Html.RadioButton("CheckYN", false)%>
                    Chưa kiểm tra
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <input type="hidden" id="nAnswers" name="nAnswers" value="0" />
                    <input type="hidden" id="nPubAnswers" name="nPubAnswers" value="0" />
                    <input type="hidden" id="nViews" name="nViews" value="0" />
                    <input type="hidden" id="AddDate" name="AddDate" value="<%= DateTime.Now %>" />
                    <input type="submit" id="btnSave" value="Thêm mới" onclick="return check_extension('ArticleImage','btnSave');" />
                </td>
            </tr>
        </tbody>
    </table>
    <%}
      } %>

    <script type="text/javascript">
        $(document).ready(function() {
            $("#adminForm").validate();
        });
        tinyMCE.init({
            mode: "exact",
            elements: "QuestionContent",
            theme: "advanced",
            plugins: "spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,paste,imagemanager",
            theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
            theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
            theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
            theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
            theme_advanced_toolbar_location: "top",
            theme_advanced_toolbar_align: "left",
            theme_advanced_statusbar_location: "bottom",
            paste_use_dialog: false,
            paste_auto_cleanup_on_paste: true,
            paste_convert_headers_to_strong: false,
            paste_strip_class_attributes: "all",
            paste_remove_spans: true,
            paste_remove_styles: true
        });        
    </script>

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Toolbar" runat="server">
    <%= Html.Toolbar("Quay lại", "/Question", "back")%>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Header" runat="server">
    Thêm câu hỏi
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Message" runat="server">
    <%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%>
</asp:Content>
